﻿@model ChurchDiary.TableEntity.EntityLabels
<script src="~/Scripts/AdminControllers/MasterJobtitleRoleController.js"></script>
<style>
    .menubox { height: 60px; border: 1px solid #fff; text-align: center; padding: 10px; cursor: pointer; }
        .menubox:hover { opacity: 0.8; }
    .boxactive {opacity: 0.7; }
</style>
<div class="row" ng-controller="MasterJobtitleRoleController">
    <div class="search-bar collapsed">
        <div class="form-group">
            <div class="input-group input-group-lg">
                <input type="text" class="form-control" placeholder="Type to search..." ng-model="search" ng-change="filter()">
                <span class="input-group-btn">
                    <button class="btn btn-square btn-lg btn-default no-shadow close-search-bar" type="button"><i class="zmdi zmdi-close"></i></button>
                </span>
            </div>
        </div>
    </div>
    <div class="col-md-12">
        <div class="bg-white bs-0 mb-20 widget">
            <ul class="nav nav-pills bg-black bs-inset-primary" role="tablist">
                <li role="presentation" class="pt-15 pb-15 pl-10 pr-20 mb-0">
                    <h3 class="fs-16 lh-1 m-0 text-white text-uppercase">Jobtitle Role</h3>
                </li>
                <li class="pull-right pt-15 pb-15 pl-20 pr-10 fs-20 lh-1 mb-0">
                    <ul class="pull-right list-inline fs-16 lh-1 mb-0">
                        <li><a href="javascript:;" class="text-white" ng-click="toggle('add','')"><i class="fa fa-plus-circle"></i></a></li>
                    </ul>
                </li>
            </ul>
            <div class="widget-body">
                <div class="row">
                    <div class="col-md-12">
                        <table class="table table-striped table-bordered">
                            <thead>
                                 <th>Board Name<a ng-click="sort_by('BoardName');"><i class="glyphicon glyphicon-sort"></i></a></th>
                                <th>Jobtitle Name<a ng-click="sort_by('BoardName');"><i class="glyphicon glyphicon-sort"></i></a></th>
                                <th>Menu Category&nbsp;<a ng-click="sort_by('BoardAbbrivation');"><i class="glyphicon glyphicon-sort"></i></a></th>
                                <th>Main Menu&nbsp;<a ng-click="sort_by('BoardAbbrivation');"><i class="glyphicon glyphicon-sort"></i></a></th>
                                <th>Sub Menu&nbsp;<a ng-click="sort_by('BoardAbbrivation');"><i class="glyphicon glyphicon-sort"></i></a></th>
                                <th>@Html.LabelFor(m => m.Action)&nbsp;</th>
                            </thead>
                            <tbody>
                                <tr ng-repeat="data in filtered = (list | filter:search | orderBy : predicate :reverse) | startFrom:(currentPage-1)*entryLimit | limitTo:entryLimit">
                                    <td>{{data.BoardJobtitle.ChurchBoard.BoardName}}</td>
                                    <td>{{data.BoardJobtitle.JobtitleName}}</td>
                                    <td>{{data.UserType.MainMenu}}</td>
                                    <td>{{data.UserType.SubMenu}}</td>
                                    <td>{{data.UserType.MenuCategory}}</td>
                                    <td>
                                        <div class="btn-group-sm" role="group" aria-label="Second group">
                                            <button type="button" class="btn btn-info waves-effect" ng-click="toggle('edit',data.JobtitleRoleId);"><i class="fa fa-pencil"></i></button>
                                            <button type="button" class="btn btn-danger waves-effect" ng-click="delete(data.BoardJobtitle.JobtitleName,data.JobtitleRoleId)"><i class="fa fa-trash"></i></button>
                                        </div>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="col-md-12" ng-show="filteredItems == 0">
                        <div class="col-md-12" style="text-align: center;">
                            <h4>@Html.LabelFor(c => c.NoData)</h4>
                        </div>
                    </div>
                </div>
                <div ng-show="filteredItems > 0" style="padding-right: 10px; text-align: right;">
                    <div pagination="" page="currentPage" max-size="10" on-select-page="setPage(page)" boundary-links="true" total-items="filteredItems" items-per-page="entryLimit" class="pagination-small" previous-text="«" next-text="»"></div>
                </div>
            </div>
        </div>
    </div>
    <div class="modal fade bs-example-modal-panel" tabindex="-1" id="JobtitleRole" role="dialog" aria-labelledby="myPanelModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header bg-primary">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myAnimationModalLabel">{{title}}</h4>
                </div>
                <form name="fromvalidate" novalidate>
                    <div class="modal-body">
                        <div class="form-group">
                            Board Name
                            <select ng-model="role.BoardJobtitle.BoardId" ng-options="obj.BoardId as obj.BoardName for obj in ChurchBoards"
                                class="form-control" ng-required="true">
                            </select>
                        </div>
                        <div class="form-group">
                            Jobtitle Name
                            <select ng-model="role.BoardJobtitleId" ng-options="obj.BoardJobtitleId as obj.JobtitleName for obj in ChurchJobtitle"
                                class="form-control" ng-required="true">
                            </select>
                        </div>
                        <div class="form-group">
                            <div class="col-md-3 bg-gray menubox" ng-class="{boxactive: MCategory.indexOf(data)!=-1}" ng-click="MenuCategorise(data,$index)" ng-repeat="data in Menus.entitymenucategory">
                                <div>
                                    {{data.MenuCategoryName}}
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-md-3 bg-green menubox" ng-class="{boxactive: MainMenu.indexOf(data)!=-1}" ng-click="MainMenuCategory(data)" ng-repeat="data in Menus.entitymainmenu">
                                {{data.MenuName}}
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-md-3 bg-purple menubox" ng-class="{boxactive: SubMenu.indexOf(data)!=-1}" ng-click="SubMenuCategory(data)" ng-repeat="data in Menus.entitysubMenu">
                                {{data.SubMenuName}}
                            </div>
                        </div>
                        <div class="clearfix"></div>
                        <br />
                        <div class="form-group">
                            Status
                            <select ng-model="role.status"
                                class="form-control" ng-required="true" ng-options="obj.StatusId as obj.StatusName for obj in JobtitleRolestatus">
                            </select>
                        </div>
                        <div class="form-group">
                            Landing Page
                            <select ng-model="role.LandingPage" ng-options="obj.SubMenuID as obj.SubMenuName for obj in Menus.entitysubMenu"
                                class="form-control" ng-required="true">
                            </select>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
                            <button type="button" class="btn btn-primary" ng-disabled="fromvalidate.$invalid || buttonstate" ng-click="save(modelstate);">Save</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
